package com.atom.module.lib.opengles.shader

import android.opengl.GLES30
import com.atom.module.lib.opengles.util.ShaderUtils

class GlShader(val type: Int, val id: Int) {

    companion object{
        fun createVertex(source: String):GlShader{
            return GlShader(GLES30.GL_VERTEX_SHADER, source)
        }
        fun fragmentVertex(source: String):GlShader{
            return GlShader(GLES30.GL_FRAGMENT_SHADER, source)
        }
    }
    constructor(type: Int, source: String) : this(
        type,
        ShaderUtils.createShader(type, source)
    )

    fun release() {
        ShaderUtils.deleteShader(id)
    }
}